import Vue from 'vue'
import VueRouter from 'vue-router'
import Index from '../views/index.vue'
import Layout from '@/layout'

Vue.use(VueRouter)

const routes = [
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  },
  {
    path: '/login',
    component: () => import(/* webpackChunkName: "about" */ '../views/Login.vue')
  },
  {
    path: '/404',
    name: 'notfound',
    component: () => import(/* webpackChunkName: "about" */ '../views/error/404.vue')
  },
  {
    path: '/',
    name: 'Index',
    redirect: '/index',
    component: Layout,
    children: [{path: '/index', component: Index}]
  }

]

const router = new VueRouter({
  routes
})

export default router
